package Code.Day3_20240920.com.dx.day03.UserSystem;


/**
 * @ClassName NormalUser
 * @Description 常规用户, 可以不执行密码强度验证
 * @Author 12994
 * @Date 2024/9/20 16:01
 * @Version 1.0
 **/
public sealed class NormalUser extends SysUser permits VipUser {

    public NormalUser(int userId, String userName, String userPwd, String phoneNumber) {
        super(userId, userName, userPwd, phoneNumber);
        if (!this.isPwdLegal()) throw new AssertionError("密码强度太低!");
    }

    @Override
    protected boolean isPwdLegal() {
        return !this.getUserPwd().equals("123456");
    }

    @Override
    protected void showInfo() {
        System.out.printf("您是普通用户! 用户编号: %d, 登录名: %s, 手机号: %s\n", this.getUserId(), this.getUserName(), this.getPhoneNumber());
    }
}
